package Four;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static double sumAllArea(Shape[] s) {
		double sum = 0;
		for (int i = 0; i < s.length; i++) {
			sum += s[i].getArea();
		}
		return sum;
	}

	public static double sumAllPerimeter(Shape[] s) {
		double sum = 0;
		for (int i = 0; i < s.length; i++) {
			sum += s[i].getPerimeter();
		}
		return sum;
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Shape[] s = new Shape[n];
		for (int i = 0; i < n; i++) {
			String str = scan.next();
			if (str.equals("rect")) {
				s[i] = new Rectangle(scan.nextInt(), scan.nextInt());
			} else {
				s[i] = new Circle(scan.nextInt());
			}
		}
		System.out.println(sumAllPerimeter(s));
		System.out.println(sumAllArea(s));
		System.out.println(Arrays.toString(s));
		for (int j = 0; j < n; j++) {
			System.out.println(s[j].getClass() + "," + s[j].getClass().getSuperclass());
		}
		scan.close();
	}

}
